#ifndef _PLANIF_HH_
#define _PLANIF_HH_
//
// Minitry of planifications
//
#include "munkres.h"
#include "Map.hh"
#include <set>
#include <utility>
#include "State.h"

extern CacheMap torus;


typedef std::set<std::pair<uLocation,uLocation> > action_plan_t;


struct Option
{
  uLocation from;
  uLocation to;
  float cost;

  
  Option() :
    from(0),to(0),cost(42.0) {}

  Option(uLocation _from, uLocation _to, double _cost = 1) :
    from(_from), to(_to), cost(_cost) {}

  bool operator<(const Option & b) const
  {
    return (from < b.from) or (from == b.from and to < b.to);
  }

};


bool by_increasing_cost(const Option & a, const Option & b);
bool by_decreasing_cost(const Option & a, const Option & b);
bool by_ant(const Option & a, const Option & b);



/// remove duplicate options and sum up their values/costs
void sum_up(std::vector<Option> & options);


action_plan_t get_minimal_cost_plan(std::vector<Option> & options);
action_plan_t get_maximal_cost_plan(std::vector<Option> & options);
action_plan_t get_an_optimal_plan(std::vector<Option> & options, bool minimize_cost);






#endif /* _PLANIF_HH_*/
